<template>
  <div class="worksBox">
    <div class="w-list" v-for="item in res.works" :key="item.id">
      <div class="info">
        <img :src="`https://ss.lanqb.com/${item.profile.avatar}`" alt="" />
        <p class="nickname">{{ item.profile.nickname }}</p>
      </div>
      <p class="content">{{ item.content }}</p>
      <div class="imgs">
        <img :src="`https://ss.lanqb.com/${item.works.url}`" alt="" />
        <img
          src="https://assets-cdn.lanqb.com/m-community/work-tag_3.png"
          alt=""
          class="top"
        />
      </div>
      <div class="teacher-comment">
        <div class="teacher-info">
          <div class="t-left">
            <img
              :src="`https://ss.lanqb.com/${item.top_comment.avatar}`"
              alt=""
            />
            <p class="nickname">{{ item.top_comment.nickname }}</p>
            <p class="tag"></p>
          </div>
          <div class="t-right">
            <p class="icon"></p>
            <p class="help">辅导视频</p>
          </div>
        </div>
        <div class="top_comment">{{ item.top_comment.content }}</div>
      </div>
    </div>
  </div>
</template>

<script setup>
import { getCurrentInstance, reactive } from "vue";
const { $axios, $request } =
  getCurrentInstance().appContext.config.globalProperties;

let res = reactive({
  works: [],
});

// https://m.lanqb.com/api/works?type=6&is_commun_status=0&page=1

$axios(`/lanqb/api/works?type=6&is_commun_status=0&page=1`, "GET").then(
  ({ data }) => {
    res.works = data.data;
    // console.log(res.works);
  }
);
</script>

<style lang="less">
* {
  margin: 0;
  padding: 0;
}
.worksBox {
  width: 100vw;
  height: calc(100vh - 40px -44px - 42px - 50px);
  overflow-y: scroll;
  padding: 0 15px;
  box-sizing: border-box;
  &::-webkit-scrollbar {
    display: none;
  }
  .w-list {
    .info {
      display: flex;
      align-items: center;
      margin-top: 15px;
      img {
        width: 32px;
        height: 32px;
        border-radius: 50%;
      }
      .nickname {
        margin-left: 15px;
        font-size: 15px;
        color: #000000;
      }
    }
    .content {
      color: #3f4345;
      font-size: 15px;
      padding: 10px 0;
    }
    .imgs {
      max-width: 200px;
      position: relative;
      img {
        width: 100%;
        border-radius: 10px;
      }
      .top {
        width: 62px;
        height: 21px;
        position: absolute;
        top: 10px;
        right: 10px;
      }
    }
    .teacher-comment {
      padding: 10px;
      background-color: #f7f7f7;
      border-radius: 5px;
      .teacher-info {
        display: flex;
        justify-content: space-between;
        align-items: center;
        .t-left {
          display: flex;
          align-items: center;
          img {
            width: 20px;
            height: 20px;
            border-radius: 50%;
          }
          .nickname {
            font-size: 14px;
            color: #3f4345;
            margin-left: 5px;
          }
          .tag {
            width: 54px;
            height: 17px;
            background: url(https://assets-cdn.lanqb.com/m-community/t-tag.png)
              no-repeat;
            background-size: 100% 100%;
            margin-left: 5px;
          }
        }
        .t-right {
          display: flex;
          justify-items: center;
          .icon {
            width: 16px;
            height: 16px;
            background: url(https://assets-cdn.lanqb.com/m-community/t-video.png)
              no-repeat;
            background-size: 100% 100%;
          }
          .help {
            color: #1a1b1e;
            font-size: 12px;
            margin-left: 5px;
          }
        }
      }
      .top_comment {
        margin-top: 10px;
        color: #5b6164;
        font-size: 14px;
        line-height: 22px;
      }
    }
  }
}
</style>
